package models

import "github.com/beego/beego/v2/client/orm"

const UserTableName = "user"

type User struct {
	Id   int
	Name string `orm:"size(100)"`
}

func UserQueryByName(username, pwd string) (*User, error) {
	u := User{}
	err := orm.NewOrm().QueryTable(UserTableName).Filter("name", username).Filter("name", pwd).One(&u)
	if err != nil {
		return nil, err
	}
	return &u, nil
}
